﻿  
namespace Common.Algorithm.Core;
 
//点
public struct Point3d
{
    //X坐标
    public double X { get; set; }
    //Y坐标  
    public double Y { get; set; }
    //
    public double Z { get; set; }

    /// <summary>
    /// 实例化
    /// </summary>
    /// <param name="X">X坐标值</param>
    /// <param name="Y">Y坐标值</param>
    /// <param name="Z">Z坐标值（可不传入，缺省值为0）</param>
    public Point3d(double _X, double _Y, double _Z)
    {
        this.X = _X;
        this.Y = _Y;
        this.Z = _Z;
    }

    public static Point3d operator +(Point3d pnt1, Point3d pnt2)
    {
        var newPnt = new Point3d(pnt1.X + pnt2.X, pnt1.Y + pnt2.Y, pnt1.Z + pnt2.Z);
        return newPnt;
    }
    public static Point3d operator -(Point3d pnt1, Point3d pnt2)
    {
        var newPnt = new Point3d(pnt1.X - pnt2.X, pnt1.Y - pnt2.Y, pnt1.Z - pnt2.Z);
        return newPnt;
    }
    public static Point3d operator *(Point3d pnt, double value)
    {
        var newPnt = new Point3d(pnt.X * value, pnt.Y * value, pnt.Z * value);
        return newPnt;
    }
    public static Point3d operator *(double value, Point3d pnt)
    {
        var newPnt = new Point3d(pnt.X * value, pnt.Y * value, pnt.Z * value);
        return newPnt;
    }
    public static Point3d operator /(Point3d pnt, double value)
    {
        var newPnt = new Point3d(pnt.X / value, pnt.Y / value, pnt.Z / value);
        return newPnt;
    }


}

